package com.example.myapplication_mvc

import android.os.Bundle
import android.widget.Button
import android.widget.LinearLayout
import android.widget.Spinner
import android.widget.TextView
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

class MainActivity : AppCompatActivity() {
    val expert = ProgramExpert()
    var count = 0
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_main)
        val button=findViewById<Button>(R.id.button)
        val spinner =findViewById<Spinner>(R.id.spinner)
        val textView =findViewById<TextView>(R.id.textView)
        button.setOnClickListener{
//            val selectedFeature = spinner.selectedItem.toString()
            textView.text = expert.getLanguage(spinner.selectedItem.toString())
        }
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }
        val button2 = findViewById<Button>(R.id.button2)
        val linearLayout =findViewById<LinearLayout>(R.id.linearLayout)
        button2.setOnClickListener{
            count++
            val textView = TextView(this)
            textView.text = "Text View"+count.toString()
            textView.textSize = 50f
            linearLayout.addView(textView)
        }
    }
}